// 完整的程序
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main()
{
    int i = 0, j = 0;
    char t[] = "abcdefghij", s[] = "klmnopqrstuvwxyz", *p;
    if ((p = (char *)malloc(strlen(t) + strlen(s) + 8)) == NULL)
    {
        printf("内存分配错误!\n");
        exit(1);
    }
    while ((p[i] = t[i]) != '\0')
        i++;
    while ((p[i + j] = s[j]) != '\0')
        j++;
    p[i + j] = '\0';
    printf("%s\n", p);
    for (i = 25; i > -1; i--)
        printf("%c", p[i]);
    printf("\n");
    p = p + 25;
    for (i = 0; i > -26; i--)
        printf("%c", p[i]);
    printf("\n");
    // 释放内存，必须保证指针指向申请的动态内存的开始位置，否则会出错
    p = p - 25;
    free(p);
    system("pause");
    return 0;
}